package com.lazar.bigdata.redis;

import org.junit.Before;
import org.junit.Test;
import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;

import java.util.HashSet;
import java.util.Set;

public class RedisClient {
    JedisCluster jc = null;

    @Before
    public void init(){
        Set<HostAndPort> jedisClusterNodes = new HashSet<HostAndPort>();
        jedisClusterNodes.add(new HostAndPort("10.12.100.51",7001));
        jedisClusterNodes.add(new HostAndPort("10.12.100.52",7001));
        jedisClusterNodes.add(new HostAndPort("10.12.100.53",7001));

        jc = new JedisCluster(jedisClusterNodes);
    }

    @Test
    public void SetValue(){
         String key = "name:11";
         jc.set(key,"lagou");
         System.out.println(jc.get(key));
    }

}
